package com.ems.bo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @Author: Wuzh
 * @Description:帧模型对象，每帧模型格式一致
 * 例如：心跳帧
 * 0   1   2   3   4   5   6   7
 * 0C  00  00  06  00  01  D9  0D
 * 起始码、数据长度高位、数据长度低位、命令码、设备地址高位、设备地址低位、校验和、终止码
 * 其中起始码和终止码固定位0C和0D
 * @Date Created in 21:37 2024-04-15
 * @return
 */
@Data
@ApiModel (value = "拆分储能请求帧", description = "起始码、数据长度高位、数据长度低位、命令码、设备地址高位、设备地址低位、数据、校验和、终止码")
public class FrameBo {

    @ApiModelProperty ("起始码")
    private String startCode = "0C";

    @ApiModelProperty("数据长度，合并高低位")
    private Integer dataLength;

    @ApiModelProperty("命令码")
    private String commandCode;

    @ApiModelProperty("设备地址十六进制数据高位")
    private byte deviceAddressHigh;

    @ApiModelProperty("设备地址十六进制数据低位")
    private byte deviceAddressLow;

    @ApiModelProperty("设备地址，合并高低位")
    private String deviceAddress;

    @ApiModelProperty("数据内容，具体业务帧要解析该部分内容")
    private String data;

    @ApiModelProperty("校验码")
    private String checkCode;

    @ApiModelProperty("终止码")
    private String endCode = "0D";


    @Override
    public String toString () {
        return "FrameBo{" +
                "startCode='" + startCode + '\'' +
                ", dataLength=" + dataLength +
                ", commandCode='" + commandCode + '\'' +
                ", deviceAddress='" + deviceAddress + '\'' +
                ", data='" + data + '\'' +
                ", checkCode='" + checkCode + '\'' +
                ", endCode='" + endCode + '\'' +
                '}';
    }
}
